<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="referrer" content="never">
    <script src="../js/common.js"></script>
    <link rel="stylesheet" href="../css/base.css">
    <script src="../js/vue.js"></script>
    <script src="../js/jquery.js"></script>
    <link rel="import" href="../vue-component/navBar.html">
    <!-- <link rel="import" href="../vue-component/film-item.html"> -->
    <link rel="import" href="../vue-component/film-list.html">
    <title>电影分类</title>
    <script>
        Vue.component("navBar", navBar);
        // Vue.component("filmItem", filmItem);
        Vue.component("filmList", filmList);
    </script>
    <script>
        window.onload = function () {
            new Vue({
                el: ".app",
                data: {
                    films:[]
                },
                methods:{
                    loadFilms(){
                        $.ajax({
                            url:"http://localhost/film-project/filmApi/loadFilms.php",
                            dataType:"json",
                            data:{
                                size:12
                            },
                            success:({result})=>{
                                // console.log(result);
                                this.films=result;
                            }
                        })
                    }
                },
                mounted(){
                    this.loadFilms();
                }
            })
        }
    </script>
</head>

<body>
    <!-- 项目容器 -->
    <div class="app">
        <!-- 电影搜索栏 -->
        <nav-bar></nav-bar>
        <!-- 首页正文 -->
        <div class="content-box">
            <div class="home-box">
                <div class="list-name">
                    <span>热门电影</span>
                </div>
                <!-- 电影列表 -->
                <!-- <div class="content-list">
                    <film-item v-for="(film,index) in films" :key="film.filmId" :film="film"></film-item>
                </div> -->
                
                <film-list class="content-list" :list="films"></film-list>
                
            </div>
        </div>
    </div>
</body>

</html>